# ========= drf中的序列化类 ==============
from rest_framework.serializers import ModelSerializer
# ========== 导入数据类 =================
from userweb.models import *


class DepartmentSerializer(ModelSerializer):

    class Meta:
        model = Department
        fields = "__all__"


class PositionSerializer(ModelSerializer):

    class Meta:
        model = Position
        fields = "__all__"


class AccountSerializer(ModelSerializer):
    department = DepartmentSerializer()
    position = PositionSerializer()
    class Meta:
        model = Account
        fields = "__all__"


class Roleserializer(ModelSerializer):
    account = AccountSerializer(many=True)

    class Meta:
        model = Roles
        fields = "__all__"


